<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2018/8/20
 * Time: 17:22
 */

namespace app\api\controller\v2;
use think\Controller;
use think\Db;
class TestData extends Controller
{
    public function index()
    {
        $db = Db::connect('mysql://root@127.0.0.1:3306/tp5#utf8');
        $res = $db->execute("insert testuser(name) values(?)", ['杰哥']);
        return $res;
    }

    public function fci()
    {
        $db = Db::connect('mysql://root@127.0.0.1:3306/fci#utf8');
        $res = $db->execute('insert user(name,sex,sort) values(?,?,?)', ['杰哥', '女', 1]);
        return $res;
    }

    public function db1()
    {
        $res = Db::execute("insert testuser(name) values(?)", ['大雨']);
        return $res;
    }
    public function db2()
    {
        $db = Db::connect('db2');
        $res = $db->execute('insert user(name,sex,sort) values(?,?,?)', ['大雨', '女', 1]);
        return $res;
    }
    public function db3()
    {
        $db = Db::connect('db3');
        $res = $db->execute("insert fans(fan_id,star_id) values(?,?)",[1,2]);
        return $res;
    }
}